import { http } from "@/utils/http";

type ResultTable = {
  total?: number;
  data?: Array<any>;
};

/**************** 自定义看板相关-系统设置  *****************/
// 查询自定义组件列表
export const getTableData = (data?: Record<string, any>) => {
  return http.request<ResultTable>("post", "/account/api/v1/componentKanban/pageComponentKanban", { data });
};

// 菜单树
export const getMenuData = () => {
  return http.request("post", "/account/api/v1/componentKanban/treeMenuList");
};

// 新增自定义组件
export const addTableData = (data?: Record<string, any>) => {
  return http.request("post", "/account/api/v1/componentKanban/createCustomKanban", { data });
};

// 修改自定义组件
export const editTableData = (data?: Record<string, any>) => {
  return http.request("post", "/account/api/v1/componentKanban/updateCustomKanban", { data });
};

// 删除自定义组件
export const delTableData = (data?: Record<string, any>) => {
  return http.request("post", "/account/api/v1/componentKanban/deleteCustomKanban", { data });
};

// 启用/禁用自定义组件
export const disabledData = (data?: Record<string, any>) => {
  return http.request("post", "/account/api/v1/componentKanban/updateCustomKanbanStatus", { data });
};

/**************** 自定义看板相关-工作台  *****************/
// 查询个人的自定义组件列表
export const getChartList = () => {
  return http.request<any[]>("post", "/account/api/v1/customKanban/personalKanban");
};

// 查询过滤后的自定义组件列表
export const getFilterTableData = (data?: Record<string, any>) => {
  return http.request("post", "/account/api/v1/componentKanban/queryComponentKanban", { data });
};

// 过滤后的菜单树
export const getFilterMenuData = () => {
  return http.request("post", "/account/api/v1/customKanban/customKanbanMenu");
};

// 添加自定义组件
export const addChartData = (data?: Record<string, any>) => {
  return http.request("post", "/account/api/v1/customKanban/createCustomKanban", { data });
};

// 更新自定义组件
export const updateChartData = (data?: Record<string, any>) => {
  return http.request("post", "/account/api/v1/customKanban/updateCustomKanban", { data });
};
